import pymongo

# 连接mongo
myclient = pymongo.MongoClient('mongodb://localhost:27017/')

# 连接zylts数据库
db_zylts = myclient["zylts"]

# 创建连接集合
emp = db_zylts["viewArtice"]

"""
插入一条数据
"""


def insertOne(data):
    emp.insert_one(data)


"""插入多条数据"""


def insertMany(data):
    emp.insert_many(data)


def select_one():
    one = emp.find_one()
    print(one)


def select_any(params, skip, limit):
    list = emp.find(params, skip=skip, limit=limit)
    return list


if __name__ == "__main__":
    select_any({"classify": "黄金"}, 0, 10)
